package com.lanou3g.ptp.remind.entity;

import com.alibaba.dubbo.config.annotation.Reference;
import com.lanou3g.ptp.achievement.service.SummaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class SummaryJob {

   @Autowired
   private StringRedisTemplate redisTemplate;

    @Value("REMIND-SUMMARYEMIND-")
    private String REDIS_SUMMARY_KEY_PREFIX;

   @Reference
    private SummaryService summaryService;


   public void summaryRemind(Long studentId,Long taskId){

       if (summaryService.findByTime(taskId,studentId) == null){
           String key = REDIS_SUMMARY_KEY_PREFIX + taskId;
           redisTemplate.opsForValue().set(key,studentId.toString());
       }


   }

}
